package com.meteor.user.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.TransPojo;
import com.meteor.framework.common.utils.DateUtils;
import com.meteor.user.entity.SysMerchant;
import com.meteor.user.entity.SysOrg;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import java.io.Serializable;
import java.util.Date;

/**
 * 岗位管理
 *
 * @author lynn
 * @date 2024/1/03
 */
@Data
@Schema(description = "岗位管理")
public class SysDepartmentVO implements Serializable, TransPojo {
    private static final long serialVersionUID = 1L;

    @Schema(description = "id")
    private String id;

    @Schema(description = "部门编码", required = true)
    @NotBlank(message = "部门编码不能为空")
    private String departmentCode;

    @Schema(description = "部门名称", required = true)
    @NotBlank(message = "部门名称不能为空")
    private String name;

    @Schema(description = "部门负责人")
    private String principal;

    @Schema(description = "商户名称")
    private String merchantName;

    @Schema(description = "商户id")
    @Trans(type = TransType.SIMPLE, target = SysMerchant.class, fields = "name", ref = "merchantName")
    private String merchantId;

    @Schema(description = "组织id")
    @Trans(type = TransType.SIMPLE, target = SysOrg.class, fields = "name", ref = "orgName")
    private String orgId;

    @Schema(description = "组织名称")
    private String orgName;

    @Schema(description = "排序", required = true)
    @Min(value = 0, message = "排序值不能小于0")
    private Integer sort;

    @Schema(description = "状态  0：停用   1：正常", required = true)
    @Range(min = 0, max = 1, message = "状态不正确")
    private Integer status;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
    private Date createTime;

}